package com.zcx.springcloud.service8401.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
@Slf4j
public class FlowLimitController {
    @GetMapping("/testA")
    public String testA() {
        return "------testA";
    }

    @GetMapping("/testB")
    public String testB() {
        log.info(Thread.currentThread().getName() + "\t" + "...testB");
        return "------testB";
    }

    @GetMapping("/testC")
    public String testC() throws InterruptedException {
        Thread.sleep(1000);
        return "------testC";
    }

    public static void main(String[] args) {
        int x = 0;
        boolean b1, b2, b3, b4;
        b1 = b2 = b3 = b4 = true;
        x = (b1 | b2 & b3 ^ b4) ? x++ : --x;
        System.out.println(x);
    }
}

